package com.sdhs.system.syncdata.util;

import java.lang.reflect.*;
import java.util.*;

/**
 * @author zhangmy
 * @date 2022/9/2014:57
 * @Description: 获取实体类类型
 */
public class EntityUtil {
    /**
     * 获取属性类型(type)，属性名(name)的map组成的list
     *
     * */
    public static List getFiledsInfo(Object o){
        Field[] fields=o.getClass().getDeclaredFields();
        String[] fieldNames=new String[fields.length];
        List list = new ArrayList();
        Map infoMap=null;
        String type;
        for(int i=0;i<fields.length;i++){
            infoMap = new HashMap();
            type=fields[i].getType().toString();
            type=type.replace("class java.lang.","");
            infoMap.put("type", type);
            infoMap.put("name", fields[i].getName());
            list.add(infoMap);
        }
        return list;
    }

}
